﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class StartGame : MonoBehaviour
{

    private float lastTime = 0;
    public float animationTime = 1;
    public Vector3 from = new Vector3(1, 1, 1);
    public Vector3 to = new Vector3(1.25f, 1.25f, 1.25f);
    // Start is called before the first frame update
    void Start()
    {
        //PlayerPrefs.DeleteAll();
    }

    public void startGame()
    {
        Text text = GetComponentInChildren<Text>();
        if (text != null) text.text = "加载中...";
        SceneManager.LoadSceneAsync(1);
    }

    // Update is called once per frame
    void Update()
    {
        if (lastTime < animationTime)
        {
            lastTime += Time.unscaledDeltaTime;
            float lerpFactor = lastTime / animationTime;
            base.transform.localScale = Vector3.Lerp(from, to, lerpFactor);
        }
        else
        {
            var temp = from;
            from = to;
            to = temp;
            lastTime = 0;
        }
    }
}
